package de.sup.scs.prototyp.client.ui.graphic.pultdach;

import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.GwtEvent.Type;
import com.google.gwt.user.client.ui.Widget;
import com.gwtplatform.mvp.client.HasUiHandlers;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.annotations.ContentSlot;
import com.gwtplatform.mvp.client.annotations.NameToken;
import com.google.inject.Inject;
import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
import com.gwtplatform.mvp.client.proxy.*;
import de.sup.scs.prototyp.client.ui.main.MainPagePresenter;
import de.sup.scs.prototyp.client.ui.toolbox.ToolBoxPresenter;

public class GraphicPDPresenter extends Presenter<GraphicPDPresenter.MyView, GraphicPDPresenter.MyProxy> {

    @ContentSlot
    public static final Type<RevealContentHandler<?>> TOOLBOX = new Type<RevealContentHandler<?>>();


    @ProxyCodeSplit
    @NameToken("graphicPD")
    public interface MyProxy extends ProxyPlace<GraphicPDPresenter> {}

    public interface MyView extends View {}

    private final ToolBoxPresenter toolBoxPresenter;
    private final PlaceManager placeManager;

    @Inject
    public GraphicPDPresenter(EventBus eventBus, MyView view, MyProxy proxy, ToolBoxPresenter toolBoxPresenter, PlaceManager placeManager) {
        super(eventBus, view, proxy);
        this.toolBoxPresenter = toolBoxPresenter;
        this.placeManager = placeManager;
    }

    @Override
    protected void revealInParent() {
        RevealContentEvent.fire(this, MainPagePresenter.CONTENT, this);
    }

    @Override
    protected void onReveal(){
        super.onReveal();
        setInSlot(TOOLBOX, toolBoxPresenter);
    }
}